<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title>app/controllers/surveys/t_surveys_controller.rb</title>
    <link href="screen.css" media="all" rel="stylesheet" type="text/css" />
    <link href="print.css" media="print" rel="stylesheet" type="text/css" />
    
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <script type="text/javascript" src="rcov.js"></script>
  </head>
  <body>
    <h1>Survey0 3 C0 Coverage Information - RCov</h1>
    <h2>app/controllers/surveys/t_surveys_controller.rb</h2>

    

    <div class="report_table_wrapper">
      <table class='report' id='report_table'>
        <thead>
          <tr>
            <th class="left_align">Name</th>
            <th class="right_align">Total Lines</th>
            <th class="right_align">Lines of Code</th>
            <th class="left_align">Total Coverage</th>
            <th class="left_align">Code Coverage</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td class="left_align"><a href="app-controllers-surveys-t_surveys_controller_rb.html">app/controllers/surveys/t_surveys_controller.rb</a></td>
            <td class='right_align'><tt>838</tt></td>
            <td class='right_align'><tt>660</tt></td>
            <td class="left_align"><div class="percent_graph_legend"><tt class=''>21.60%</tt></div>
          <div class="percent_graph">
            <div class="covered" style="width:22px"></div>
            <div class="uncovered" style="width:78px"></div>
          </div></td>
            <td class="left_align"><div class="percent_graph_legend"><tt class=''>12.88%</tt></div>
          <div class="percent_graph">
            <div class="covered" style="width:13px"></div>
            <div class="uncovered" style="width:87px"></div>
          </div></td>
          </tr>
        </tbody>
      </table>
    </div>
    
    <h3>Key</h3>
    
    <div class="key"><pre><span class='marked'>Code reported as executed by Ruby looks like this...</span><span class='marked1'>and this: this line is also marked as covered.</span><span class='inferred'>Lines considered as run by rcov, but not reported by Ruby, look like this,</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).</span><span class='uncovered'>Finally, here's a line marked as not executed.</span></pre></div>

    <h3>Coverage Details</h3>

    <table class="details">
      <tbody>
        
          
          
          <tr class="marked">
            <td><pre><a name="line1">1</a> require 'yaml'</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line2">2</a> class Surveys::TSurveysController &lt; ApplicationController</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line3">3</a>   layout &quot;surveys/surveys&quot;</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line4">4</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line5">5</a>   #before_filter :auth</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line6">6</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line7">7</a>   #protect_from_forgery :except =&gt; [:destroy_choice,:new_question,:pre_test,:prof_result,:record_zxs_yj]</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line8">8</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line9">9</a>   SurveyCountMethod.content_columns.each do |column|</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line10">10</a>     in_place_edit_for :survey_count_method, column.name</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line11">11</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line12">12</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line13">13</a>   def index</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line14">14</a>     @surveys = Survey.t_surveys(20,params[:page])</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line15">15</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line16">16</a>       format.html</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line17">17</a>       format.xml {render :xml =&gt; @surveys.to_xml}</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line18">18</a>       format.json {render :json =&gt; @surveys.to_json}</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line19">19</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line20">20</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line21">21</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line22">22</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line23">23</a>   def new</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line24">24</a>     @survey = Survey.new</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line25">25</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line26">26</a>       format.html # new.html.erb</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line27">27</a>       format.xml  { render :xml =&gt; @survey }</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line28">28</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line29">29</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line30">30</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line31">31</a>   def create</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line32">32</a>     @survey = Survey.new(params[:survey])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line33">33</a>     @survey.t_type = TEST_TYPE_TREND  #设置测试类型为倾向测试</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line34">34</a>     @survey.has_dimen = true #默认支持多维度</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line35">35</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line36">36</a>     if @survey.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line37">37</a>       flash[:notice] = '添加成功.'</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line38">38</a>       redirect_to(:action =&gt; &quot;index&quot;)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line39">39</a>     else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line40">40</a>       render :action =&gt; &quot;new&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line41">41</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line42">42</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line43">43</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line44">44</a>   def edit</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line45">45</a>     @survey = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line46">46</a>     @question_num = @survey.question_num</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line47">47</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line48">48</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line49">49</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line50">50</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line51">51</a>   def destroy</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line52">52</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line53">53</a>     @test.deleted = true</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line54">54</a>     @test.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line55">55</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line56">56</a>       format.html { redirect_to(:action =&gt; &quot;index&quot;) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line57">57</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line58">58</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line59">59</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line60">60</a>   def update_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line61">61</a>     @survey = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line62">62</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line63">63</a>     if @survey.update_attributes(params[:survey])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line64">64</a>       flash[:notice] = &quot;保存成功。&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line65">65</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line66">66</a>     redirect_to :action =&gt; &quot;edit&quot;, :id =&gt; @survey</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line67">67</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line68">68</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line69">69</a>   def edit_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line70">70</a>     @survey = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line71">71</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line72">72</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line73">73</a>   def new_type</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line74">74</a>     @types=SurveyType.find(:all)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line75">75</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line76">76</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line77">77</a>   def createnew_type</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line78">78</a>     @type=SurveyType.new(params[:type])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line79">79</a>     if @type.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line80">80</a>        flash[:notice]=&quot;添加成功&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line81">81</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line82">82</a>     redirect_to(:action =&gt; &quot;new_type&quot; , :id=&gt;1)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line83">83</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line84">84</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line85">85</a>   def edit_type</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line86">86</a>    @type=SurveyType.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line87">87</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line88">88</a>  </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line89">89</a>   def update_type</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line90">90</a>      @type=SurveyType.find(params[:type_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line91">91</a>     if @type.update_attributes(params[:type])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line92">92</a>       flash[:notice]=&quot;修改成功&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line93">93</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line94">94</a>      redirect_to(:action =&gt; &quot;new_type&quot;, :id =&gt; 1)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line95">95</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line96">96</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line97">97</a>   def del_dimen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line98">98</a>    @dimen = Dimen.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line99">99</a>    @dimen.destroy</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line100">100</a>    respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line101">101</a>       format.html { redirect_to(&quot;/surveys/prof_surveys/&quot;+@dimen.survey_id.to_s+&quot;/edit&quot;) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line102">102</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line103">103</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line104">104</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line105">105</a>   def del_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line106">106</a>    @part = Part.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line107">107</a>    @part.destroy</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line108">108</a>    respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line109">109</a>       format.html { redirect_to(&quot;/surveys/prof_surveys/&quot;+@part.survey_id.to_s+&quot;/edit&quot;) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line110">110</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line111">111</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line112">112</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line113">113</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line114">114</a>   def destroy_type</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line115">115</a>    @type = SurveyType.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line116">116</a>    @type.destroy</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line117">117</a>    respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line118">118</a>       format.html { redirect_to(:action =&gt; &quot;new_type&quot;,:id=&gt;1) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line119">119</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line120">120</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line121">121</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line122">122</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line123">123</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line124">124</a>   def edit_test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line125">125</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line126">126</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line127">127</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line128">128</a>   def update_test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line129">129</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line130">130</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line131">131</a>     if @test.update_attributes(params[:test])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line132">132</a>       flash[:notice] = &quot;保存成功。&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line133">133</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line134">134</a>     redirect_to :action =&gt; &quot;edit_test&quot;, :id =&gt; @test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line135">135</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line136">136</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line137">137</a>   def new_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line138">138</a>     @test_id = params[:id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line139">139</a>     @part = Part.new</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line140">140</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line141">141</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line142">142</a>   def create_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line143">143</a>     @test = Survey.find(params[&quot;test_id&quot;].to_i)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line144">144</a>     @test_id = @test.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line145">145</a>     @part = Part.new(params[:part])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line146">146</a>     @part.survey = @test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line147">147</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line148">148</a>       if @part.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line149">149</a>         flash[:notice] = '添加成功.'</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line150">150</a>         flash[:part_id] = @part.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line151">151</a>         format.html { redirect_to(:action =&gt; &quot;edit&quot;, :id =&gt; @test.id) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line152">152</a>       else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line153">153</a>         format.html { render :action =&gt; &quot;new_part&quot; }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line154">154</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line155">155</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line156">156</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line157">157</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line158">158</a>   def new_questions</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line159">159</a>     @part = Part.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line160">160</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line161">161</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line162">162</a>   #编辑子量表</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line163">163</a>   def edit_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line164">164</a>     @part = Part.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line165">165</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line166">166</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line167">167</a>   def update_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line168">168</a>     @part = Part.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line169">169</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line170">170</a>     if @part.update_attributes(params[:part])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line171">171</a>       flash[:notice] = &quot;保存成功。&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line172">172</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line173">173</a>     redirect_to :action =&gt; &quot;edit_part&quot;, :id =&gt; @part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line174">174</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line175">175</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line176">176</a>   #添加题目</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line177">177</a>   def create_question</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line178">178</a>     @part = Part.find(params[:part_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line179">179</a>     </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line180">180</a>     @question = Question.new(params[:question])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line181">181</a>     @question.part = @part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line182">182</a>     @question.survey = @part.survey</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line183">183</a>    # begin</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line184">184</a>      @question.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line185">185</a>       if params[&quot;choice.content&quot;]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line186">186</a>         i = 0;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line187">187</a>           params[&quot;choice.content&quot;].each do |content|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line188">188</a>           choice = Choice.new(:content =&gt; content, :value =&gt; params[&quot;choice.value&quot;][i])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line189">189</a>           choice.question = @question</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line190">190</a>           choice.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line191">191</a>           i += 1</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line192">192</a>           end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line193">193</a>        end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line194">194</a>        flash[:q_error]=@question.errors[:number]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line195">195</a>        @heighlight_id = @question.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line196">196</a>    </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line197">197</a>        respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line198">198</a>          format.html { render :partial =&gt; &quot;questions&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line199">199</a>        end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line200">200</a>         </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line201">201</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line202">202</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line203">203</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line204">204</a>   #添加题目</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line205">205</a>   def create_question_by_test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line206">206</a>     @test = Survey.find(params[:test_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line207">207</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line208">208</a>     @question = Question.new(params[:question])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line209">209</a>     @question.survey = @test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line210">210</a>     @question.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line211">211</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line212">212</a>     if params[&quot;choice.content&quot;]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line213">213</a>       i = 0;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line214">214</a>       params[&quot;choice.content&quot;].each do |content|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line215">215</a>         choice = Choice.new(:content =&gt; content, :value =&gt; params[&quot;choice.value&quot;][i])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line216">216</a>         choice.question = @question</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line217">217</a>         choice.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line218">218</a>         i += 1</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line219">219</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line220">220</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line221">221</a>     flash[:q_error]=@question.errors[:number]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line222">222</a>     #设置高亮显示的元素</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line223">223</a>     @heighlight_id = @question.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line224">224</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line225">225</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line226">226</a>      format.html { render :partial =&gt; &quot;questions_1&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line227">227</a> #      format.html { render :text =&gt; &quot;questions_1&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line228">228</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line229">229</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line230">230</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line231">231</a>   #响应拖拽事件，排列quesiton的顺序</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line232">232</a>   def sort</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line233">233</a>     @part = Part.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line234">234</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line235">235</a>     @part.questions.each do |q|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line236">236</a>       q.position = params['question-list'].index(q.id.to_s) + 1</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line237">237</a>       q.save!</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line238">238</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line239">239</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line240">240</a>     #读取排列顺序后的questions</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line241">241</a>     @part.questions.sort {|a, b| b.position &lt;=&gt; a.position}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line242">242</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line243">243</a>     render :noting =&gt; true</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line244">244</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line245">245</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line246">246</a>   #响应拖拽事件，排列quesiton的顺序</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line247">247</a>   def sort_no_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line248">248</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line249">249</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line250">250</a>     @test.questions.each do |q|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line251">251</a>       q.position = params['question-list'].index(q.id.to_s) + 1</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line252">252</a>       q.save!</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line253">253</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line254">254</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line255">255</a>     #读取排列顺序后的questions</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line256">256</a>     @test.questions.sort {|a, b| b.position &lt;=&gt; a.position}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line257">257</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line258">258</a>     render :noting =&gt; true</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line259">259</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line260">260</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line261">261</a>   def new_dimen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line262">262</a>     @test_id = params[:id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line263">263</a>     @dimen = Dimen.new</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line264">264</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line265">265</a>   #添加维度</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line266">266</a>   def create_dimen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line267">267</a>     @test = Survey.find(params[&quot;test_id&quot;].to_i)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line268">268</a>     @test_id = @test.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line269">269</a>     @dimen= Dimen.new(params[:dimen])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line270">270</a>     @dimen.survey = @test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line271">271</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line272">272</a>       if @dimen.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line273">273</a>         flash[:notice] = '添加成功.'</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line274">274</a>         flash[:dimen_id] = @dimen.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line275">275</a>         format.html { redirect_to(:action =&gt; &quot;edit&quot;, :id =&gt; @test.id) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line276">276</a>       else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line277">277</a>         format.html { render :action =&gt; &quot;new_dimen&quot; }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line278">278</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line279">279</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line280">280</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line281">281</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line282">282</a>   #定义计分方式</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line283">283</a>   def edit_count_method</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line284">284</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line285">285</a>     @survey_count_method =</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line286">286</a>       @test.survey_count_method == nil ? SurveyCountMethod.new : @test.survey_count_method</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line287">287</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line288">288</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line289">289</a>   #添加计分方式</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line290">290</a>   def create_survey_count_method</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line291">291</a>     @survey_count_method = SurveyCountMethod.new(:add_num =&gt; params[:survey_count_method][:add_num])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line292">292</a>     @test = Survey.find(params[:test_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line293">293</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line294">294</a>     @survey_count_method.total = CountMethod.find(params[:survey_count_method][:total])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line295">295</a>     @survey_count_method.avg = CountMethod.find(params[:survey_count_method][:avg])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line296">296</a>     @survey_count_method.children_total = CountMethod.find(params[:survey_count_method][:children_total])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line297">297</a>     @survey_count_method.children_avg= CountMethod.find(params[:survey_count_method][:children_total])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line298">298</a>     @survey_count_method.dimen_total = CountMethod.find(params[:survey_count_method][:dimen_total])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line299">299</a>     @survey_count_method.dimen_avg = CountMethod.find(params[:survey_count_method][:dimen_avg])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line300">300</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line301">301</a>     @test.survey_count_method = @survey_count_method</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line302">302</a>     @test.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line303">303</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line304">304</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line305">305</a>       if @survey_count_method.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line306">306</a>         flash[:notice] = '添加成功.'</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line307">307</a>       else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line308">308</a>         flash[:notice] = '添加失败.'</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line309">309</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line310">310</a>       format.html { redirect_to(:action =&gt; &quot;edit_count_method&quot;, :id =&gt; @test) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line311">311</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line312">312</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line313">313</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line314">314</a>   #定义常模</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line315">315</a>   def edit_norm</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line316">316</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line317">317</a>     @norm_info = @test.norm_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line318">318</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line319">319</a>     if @test.norm_info.norm_type == NORM_TYPE_TEXT</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line320">320</a>       render &quot;new_norm&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line321">321</a>     else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line322">322</a>       @norms = Norm.cross_table(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line323">323</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line324">324</a>       @item_types = [</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line325">325</a>         [NOT_IMPORT, NOT_IMPORT],</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line326">326</a>         [NORM_ITEM_TYPE_PART, NORM_ITEM_TYPE_PART],</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line327">327</a>         [NORM_ITEM_TYPE_DIMEN, NORM_ITEM_TYPE_DIMEN]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line328">328</a>       ]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line329">329</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line330">330</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line331">331</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line332">332</a>   #根据item_type得到item列表</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line333">333</a>   def items_by_type</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line334">334</a>     test_id = params[:test_id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line335">335</a>     if params[:item_type] == NORM_ITEM_TYPE_NUM</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line336">336</a>       @items = []</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line337">337</a>     elsif params[:item_type] == NORM_ITEM_TYPE_PART</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line338">338</a>       @items = Part.find_all_by_test_id(test_id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line339">339</a>     elsif params[:item_type] == NORM_ITEM_TYPE_DIMEN</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line340">340</a>       @items = Dimen.find_all_by_test_id(test_id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line341">341</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line342">342</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line343">343</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line344">344</a>     render :partial =&gt; &quot;select&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line345">345</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line346">346</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line347">347</a>   def create_norm</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line348">348</a>     @test = Survey.find(params[:test_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line349">349</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line350">350</a>     @norm = Norm.new(params[:norm])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line351">351</a>     @norm.survey = @test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line352">352</a>     @norm.explanation = &quot;默认&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line353">353</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line354">354</a>     @norm.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line355">355</a>     </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line356">356</a>     #设置高亮显示的元素</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line357">357</a>     @heighlight_id = @norm.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line358">358</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line359">359</a>     @norms = Norm.cross_table(params[:test_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line360">360</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line361">361</a>       format.html { render :partial =&gt; &quot;norms&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line362">362</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line363">363</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line364">364</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line365">365</a>   #添加文本常模</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line366">366</a>   def create_text_norm</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line367">367</a>     @test = Survey.find(params[:test_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line368">368</a>     @norm_info = @test.norm_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line369">369</a>     @norm_info.description = params[:norm_info][:description]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line370">370</a>     if @norm_info.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line371">371</a>       flash[:notice] = &quot;常模保存成功&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line372">372</a>       redirect_to :action =&gt; &quot;edit&quot;, :id =&gt; @test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line373">373</a>     else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line374">374</a>       render &quot;new_norm&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line375">375</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line376">376</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line377">377</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line378">378</a>   #用iframe显示报告，这样的话页面的样式就不会被其他样式影响</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line379">379</a>   def _report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line380">380</a>     @norm_info = NormInfo.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line381">381</a>     render :layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line382">382</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line383">383</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line384">384</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line385">385</a>   def destroy_choice</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line386">386</a>      c_id=params[:id].split(&quot;$&quot;)[0]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line387">387</a>      t_id=params[:id].split(&quot;$&quot;)[1]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line388">388</a>      choice=Choice.find(c_id.to_i)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line389">389</a>      choice.destroy</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line390">390</a>      respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line391">391</a>       format.html { redirect_to(:action =&gt; &quot;new_question&quot;,:id=&gt;t_id.to_i) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line392">392</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line393">393</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line394">394</a>   #测试完成，可以上线</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line395">395</a>   def finish</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line396">396</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line397">397</a>     @test.status = TEST_STATUS_FINISHED</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line398">398</a>     @test.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line399">399</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line400">400</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line401">401</a>       format.html { redirect_to(:action =&gt; &quot;index&quot;) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line402">402</a>       format.xml  { head :ok }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line403">403</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line404">404</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line405">405</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line406">406</a>   #量表停用</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line407">407</a>   def stop</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line408">408</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line409">409</a>     @test.status = TEST_STATUS_UNFINISHED</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line410">410</a>     @test.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line411">411</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line412">412</a>       format.html { redirect_to(:action =&gt; &quot;index&quot;) }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line413">413</a>       format.xml  { head :ok }</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line414">414</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line415">415</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line416">416</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line417">417</a>   def new_question</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line418">418</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line419">419</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line420">420</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line421">421</a>   def new_norm_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line422">422</a>     @test_id = params[:id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line423">423</a>     @norm_info = NormInfo.new</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line424">424</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line425">425</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line426">426</a>   def create_norm_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line427">427</a>     @test = Survey.find(params[:test_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line428">428</a>     @norm_info = @test.norm_info</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line429">429</a>     @norm_info.description = params[:norm_info][:description]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line430">430</a>     if @norm_info.save!</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line431">431</a>       flash[:notice] = &quot;保存成功&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line432">432</a>       redirect_to :action =&gt; &quot;edit&quot;, :id =&gt; @test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line433">433</a>     else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line434">434</a>       render &quot;new_norm_info&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line435">435</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line436">436</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line437">437</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line438">438</a>  #预测试</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line439">439</a>   def pre_test</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line440">440</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line441">441</a>     if @test.t_type == TEST_TYPE_PROF</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line442">442</a>       if @test.has_part != 0</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line443">443</a>        @pages = @test.paging</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line444">444</a> #p @pages.to_s+&quot;==========--------------------------=========================&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line445">445</a>         if @test.rg_method == &quot;ruiwen&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line446">446</a>           flash[:agenotice]=&quot;请准确填写被测者年龄，如：5岁填5，5岁半 填写5.5。每半岁一个年龄段。本量表适合于5到17岁&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line447">447</a>         end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line448">448</a>         render :template =&gt; &quot;surveys/prof_surveys/prof_survey&quot;,:layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line449">449</a>       else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line450">450</a>        @survey = @test.paging_no_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line451">451</a>         render :template =&gt; &quot;surveys/prof_surveys/prof_survey_no_part&quot;,:layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line452">452</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line453">453</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line454">454</a>   end </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line455">455</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line456">456</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line457">457</a>   def record_zxs_yj</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line458">458</a>     id=params[:record_id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line459">459</a>     @test_record = PreSurveyRecord.find(id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line460">460</a>     zxsyj=params[:report][:zxs_yj]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line461">461</a>     @test_record.zxs_yj=zxsyj</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line462">462</a>     @test_zxs_yj=@test_record.zxs_yj</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line463">463</a>     p &quot;=======#{id.to_s}====#{zxsyj}====&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line464">464</a>     @test_record.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line465">465</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line466">466</a>       format.html { render :partial=&gt;&quot;zxs_yj&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line467">467</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line468">468</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line469">469</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line470">470</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line471">471</a>    def show_report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line472">472</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line473">473</a>     @test=Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line474">474</a>     @user = current_user</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line475">475</a>     # 清空 预测数据库表 </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line476">476</a>     PreSurveyRecord.delete_all</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line477">477</a>     PreOriginalResult.delete_all</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line478">478</a>     #username = params[:username].strip == &quot;&quot; ? &quot;匿名&quot; : params[:username]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line479">479</a>     @test_record = PreSurveyRecord.new(:username =&gt; &quot;匿名测试&quot;)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line480">480</a>     @test_record.age=params[:age]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line481">481</a>     @test_record.gender=params[:gender]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line482">482</a>     @test_record.perfession=params[:perfession]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line483">483</a>     @test_record.edu_status=params[:edu_status]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line484">484</a>     @test_record.testname=@test.name</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line485">485</a>     @test_record.testtime=params[:timer]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line486">486</a>     #@test_record.username = username </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line487">487</a>     @test_record.survey_id = params[:id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line488">488</a>     @test_record.org = @user</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line489">489</a>     @test_record.save!</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line490">490</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line491">491</a>      params[:question_id].each do |q_id|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line492">492</a>       #收集每道题的分值／记录原始分</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line493">493</a>       </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line494">494</a>       @or = PreOriginalResult.new</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line495">495</a>       @or.survey_id=params[:survey_id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line496">496</a>       @or.question_id = q_id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line497">497</a>       @or.part_id = params[&quot;question-#{q_id}-part&quot;].to_i if @test.has_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line498">498</a>       @or.value = Float(params[&quot;question-#{q_id}-value&quot;])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line499">499</a>       @or.choice_num = params[&quot;question-#{q_id}-choice&quot;]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line500">500</a>       @or.test_record_id = @test_record.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line501">501</a>       @or.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line502">502</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line503">503</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line504">504</a>     #如果是独立的量表，就使用单独的报告生成策略</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line505">505</a>     rg_method=@test_record.survey.rg_method</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line506">506</a>     if rg_method &amp;&amp; rg_method.length !=0 </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line507">507</a>       generate_report(@test_record.survey.rg_method)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line508">508</a>     else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line509">509</a>       do_report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line510">510</a>       respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line511">511</a>         format.html { render :layout =&gt; false}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line512">512</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line513">513</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line514">514</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line515">515</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line516">516</a>   #导出为pdf</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line517">517</a>   def report_pdf</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line518">518</a>     @test_record = PreSurveyRecord.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line519">519</a>     do_report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line520">520</a>     @dimens = []</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line521">521</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line522">522</a>     @dimen_results.each do |d|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line523">523</a>       dim = Dimen.find(d.dimen.id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line524">524</a>       name = dim.name</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line525">525</a>       if  dim.formula and dim.formula.size &gt; 0</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line526">526</a>         total = count_by_formula(d.total, Dimen.find(d.dimen.id).formula)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line527">527</a>       else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line528">528</a>         total = d.total</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line529">529</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line530">530</a>       </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line531">531</a>       @dimens.push([name, total])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line532">532</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line533">533</a>     render :file =&gt; &quot;/surveys/prof_surveys/report_pdf.prawn&quot;, :layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line534">534</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line535">535</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line536">536</a>   def do_report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line537">537</a>     #@test_record = PreSurveyRecord.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line538">538</a>     #统计分数</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line539">539</a>     </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line540">540</a>      @test_zxs_yj=@test_record.zxs_yj</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line541">541</a>     @total = PreOriginalResult.sum(:value, :conditions =&gt; [&quot;test_record_id = ?&quot;, @test_record.id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line542">542</a>     @avg = PreOriginalResult.average(:value, :conditions =&gt; [&quot;test_record_id = ?&quot;, @test_record.id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line543">543</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line544">544</a>     @original_results = PreOriginalResult.find_all_by_test_record_id(@test_record.id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line545">545</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line546">546</a>     @part_results = PreOriginalResult.find_by_sql(</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line547">547</a>       [ &quot;select part_id, sum(value) total, avg(value) avg from pre_original_results</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line548">548</a>           where test_record_id = ? group by part_id&quot;, @test_record.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line549">549</a>       ]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line550">550</a>     )</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line551">551</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line552">552</a>     @dimen_results = PreOriginalResult.find_by_sql(</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line553">553</a>       [ &quot;select dimen_id, sum(value) total, avg(value) avg from</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line554">554</a>           (select question_id, value from pre_original_results where test_record_id = ?) t1,</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line555">555</a>           (select * from dimens_questions) t2</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line556">556</a>          where t1.question_id = t2.question_id group by dimen_id&quot;,</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line557">557</a>         @test_record.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line558">558</a>       ]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line559">559</a>     )</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line560">560</a>   </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line561">561</a>     @norms = Norm.cross_table(@test_record.survey_id.to_s)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line562">562</a>     @test = @test_record.survey</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line563">563</a>     #report_xml(@test_record.id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line564">564</a>     #PreOriginalResult.delete_all</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line565">565</a>     #PreSurveyRecord.delete_all</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line566">566</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line567">567</a>   #维度图表 xml </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line568">568</a>   def report_xml</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line569">569</a>     sql=&quot;select dimen_id, sum(value) total, avg(value) avg from</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line570">570</a>           (select question_id, value from pre_original_results where test_record_id = #{params[:id]}) t1,</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line571">571</a>           (select * from dimens_questions) t2</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line572">572</a>          where t1.question_id = t2.question_id group by dimen_id&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line573">573</a>     @dimen_results = PreOriginalResult.find_by_sql(sql)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line574">574</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line575">575</a>     headers[&quot;Content-Type&quot;] = &quot;text/xml; charset=utf-8&quot;  # xml content with charset=uttf-8</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line576">576</a>     render :layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line577">577</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line578">578</a>   #  分量表图表 xml </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line579">579</a>   def part_report_xml</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line580">580</a>    sql=&quot;select part_id, sum(value) total, avg(value) avg from pre_original_results</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line581">581</a>           where test_record_id = #{params[:id]} group by part_id&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line582">582</a>    @part_results = PreOriginalResult.find_by_sql(sql)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line583">583</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line584">584</a>     headers[&quot;Content-Type&quot;] = &quot;text/xml; charset=utf-8&quot;  # xml content with charset=uttf-8</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line585">585</a>     render :layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line586">586</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line587">587</a>   </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line588">588</a>   def ept_report_xml</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line589">589</a>       sql=&quot;select dimen_id, sum(value) total, avg(value) avg from</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line590">590</a>                 (select question_id, value from pre_original_results where test_record_id = #{params[:id]}) t1,</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line591">591</a>                 (select * from dimens_questions) t2</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line592">592</a>                where t1.question_id = t2.question_id group by dimen_id&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line593">593</a>       dimen_results = OriginalResult.find_by_sql(sql)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line594">594</a>       test_record=SurveyRecord.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line595">595</a>       gender=test_record.gender</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line596">596</a>       @ept_drs=[]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line597">597</a>      dimen_results.each do |dimen_r|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line598">598</a>          item=[]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line599">599</a>          if  dimen_r.total.to_i &gt; 20</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line600">600</a>              dimen_r.total= 20</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line601">601</a>          end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line602">602</a>          sql1=&quot;select * from ept_trans where original_mark = #{dimen_r.total}&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line603">603</a>          t_result=EptTran.find_by_sql(sql1)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line604">604</a>          if gender==&quot;男&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line605">605</a>              columnname=Dimen.find(dimen_r.dimen_id).name+&quot;1&quot;.to_s</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line606">606</a>              dimen_r.total = t_result[0].send(columnname)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line607">607</a>              item &lt;&lt; dimen_r.dimen_id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line608">608</a>              item &lt;&lt; dimen_r.total</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line609">609</a>          else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line610">610</a>             columnname=Dimen.find(dimen_r.dimen_id).name+&quot;0&quot;.to_s</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line611">611</a>             dimen_r.total = t_result[0].send(columnname)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line612">612</a>              item &lt;&lt; dimen_r.dimen_id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line613">613</a>              item &lt;&lt; dimen_r.total</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line614">614</a>          end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line615">615</a>          @ept_drs &lt;&lt; item</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line616">616</a>        end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line617">617</a>        headers[&quot;Content-Type&quot;] = &quot;text/xml; charset=utf-8&quot;  # xml content with charset=uttf-8 </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line618">618</a>        render  :layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line619">619</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line620">620</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line621">621</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line622">622</a>   #给测试增加图片</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line623">623</a>   def add_image_fortest</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line624">624</a>    @test=Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line625">625</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line626">626</a>   def create_image_fortest</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line627">627</a>       @image = Image.new(params[:image])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line628">628</a>      @image.survey_id=params[:t_id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line629">629</a>      @image.filename=@image.filename</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line630">630</a>      if @image.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line631">631</a>          flash[:notice] = '图片添加成功'</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line632">632</a>          redirect_to(:action=&gt;&quot;index&quot; )</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line633">633</a>      else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line634">634</a>          redirect_to(:action=&gt;&quot;index&quot; )</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line635">635</a>      end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line636">636</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line637">637</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line638">638</a>   def edit_dimen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line639">639</a>     @dimen = Dimen.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line640">640</a>     @questions = @dimen.survey.questions</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line641">641</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line642">642</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line643">643</a>   def update_dimen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line644">644</a>     @dimen = Dimen.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line645">645</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line646">646</a>     if params[:dimen] == nil or params[:dimen][:question_ids] == nil</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line647">647</a>       params[:dimen] = Hash.new</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line648">648</a>       params[:dimen][:question_ids] = []</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line649">649</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line650">650</a>     if @dimen.update_attributes(params[:dimen])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line651">651</a>       flash[:notice] = &quot;保存成功。&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line652">652</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line653">653</a>     redirect_to :action =&gt; &quot;edit_dimen&quot;, :id =&gt; @dimen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line654">654</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line655">655</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line656">656</a>   def check</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line657">657</a>     @test = Survey.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line658">658</a>     if @test.norm_info.norm_type == NORM_TYPE_TEXT</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line659">659</a>       </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line660">660</a>     else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line661">661</a>       </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line662">662</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line663">663</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line664">664</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line665">665</a>   def destroy_question</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line666">666</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line667">667</a>     @question = Question.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line668">668</a>     @part = @question.part </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line669">669</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line670">670</a>     @question.delete</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line671">671</a>     @question.choices.delete_all</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line672">672</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line673">673</a>     @hide_id = @question.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line674">674</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line675">675</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line676">676</a>       format.html { render :partial =&gt; &quot;questions&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line677">677</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line678">678</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line679">679</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line680">680</a>   def destroy_question_no_part</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line681">681</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line682">682</a>     @question = Question.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line683">683</a>     @test = @question.survey</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line684">684</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line685">685</a>     @question.delete</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line686">686</a>     @question.choices.delete_all</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line687">687</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line688">688</a>     @hide_id = @question.id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line689">689</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line690">690</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line691">691</a>       format.html { render :partial =&gt; &quot;questions_1&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line692">692</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line693">693</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line694">694</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line695">695</a>   def update_question</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line696">696</a>      @test = Survey.find(params[:test_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line697">697</a>      @question_num = params[:question_num]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line698">698</a>      @question = Question.find(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line699">699</a>      @question.number=params[:question_number]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line700">700</a>      @question.can_ignore = params[:can_ignore]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line701">701</a>      @question.description = params[&quot;description&quot;]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line702">702</a>    begin</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line703">703</a>     @question.save!</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line704">704</a>     params[&quot;choice_ids&quot;].each do |id|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line705">705</a>       choice = Choice.find(id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line706">706</a>       choice.content = params[&quot;choice#{id}&quot;][&quot;content&quot;]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line707">707</a>       choice.value = params[&quot;choice#{id}&quot;][&quot;value&quot;]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line708">708</a>       choice.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line709">709</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line710">710</a>       respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line711">711</a>         format.html { render :partial =&gt; &quot;question&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line712">712</a>       end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line713">713</a>     rescue</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line714">714</a>        flash[:q_error]=@question.errors[:number]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line715">715</a>        respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line716">716</a>          format.html { render :partial =&gt; &quot;question&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line717">717</a>         end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line718">718</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line719">719</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line720">720</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line721">721</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line722">722</a>   def explanations</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line723">723</a>      dimen_id=params[:id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line724">724</a>     @explanations=Explanation.find(:all, :conditions=&gt; [ &quot;dimen_id = ?&quot;, dimen_id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line725">725</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line726">726</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line727">727</a>   def new_expl</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line728">728</a>     @explanation=Explanation.new</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line729">729</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line730">730</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line731">731</a>   def create_expl</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line732">732</a>     @explanation=Explanation.new(params[:explanation])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line733">733</a>     id=params[:explanation][:dimen_id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line734">734</a>     @explanation.save</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line735">735</a>     redirect_to(:action=&gt;&quot;explanations&quot; ,:id=&gt;id)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line736">736</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line737">737</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line738">738</a>  def del_expl</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line739">739</a>    explanation=Explanation.find_by_id(params[:id])</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line740">740</a>    d_id=explanation.dimen_id</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line741">741</a>    explanation.destroy</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line742">742</a>    respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line743">743</a>       format.html { redirect_to(&quot;/surveys/prof_surveys/explanations/#{d_id.to_s}&quot;)}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line744">744</a>    end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line745">745</a>  end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line746">746</a>   </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line747">747</a>  #---------------------独立量表--------------------</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line748">748</a>   def generate_report(generate_method)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line749">749</a>     send(generate_method)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line750">750</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line751">751</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line752">752</a>   def mmpi</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line753">753</a>     </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line754">754</a>     @report = CustomSurveys::Mmpi.pre_report(@test_record)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line755">755</a>     #@t_xml = CustomSurveys::Mmpi.pre_t_xml(@report)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line756">756</a>     @t_json = CustomSurveys::Mmpi.pre_t_json(@report)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line757">757</a> pp @t_json</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line758">758</a>     respond_to do |format|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line759">759</a>       format.html { render :template =&gt; &quot;user/reports/custom/mmpi&quot;, :layout =&gt; &quot;report&quot;}</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line760">760</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line761">761</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line762">762</a> </pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line763">763</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line764">764</a>   def sixteen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line765">765</a>     do_report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line766">766</a>     @expls = CustomSurveys::Sixteen.expls(@dimen_results, @test_record.gender)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line767">767</a>     render :template =&gt; &quot;user/reports/custom/sixteen&quot;, :layout =&gt; &quot;report&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line768">768</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line769">769</a> </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line770">770</a>   def ept</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line771">771</a>     do_report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line772">772</a>     gender=@test_record.gender</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line773">773</a>     if gender== nil </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line774">774</a>         gender=&quot;男&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line775">775</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line776">776</a>     @ept_avg=@avg</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line777">777</a>     @ept_total=@total</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line778">778</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line779">779</a>      @dimen_results.each do |dimen_r|</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line780">780</a>      if  dimen_r.total.to_i&gt; 20</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line781">781</a>          dimen_r.total= 20</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line782">782</a>      end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line783">783</a>        sql=&quot;select * from ept_trans where original_mark = #{dimen_r.total}&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line784">784</a>        t_result=EptTran.find_by_sql(sql)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line785">785</a>        if gender==&quot;男&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line786">786</a>            columnname=Dimen.find(dimen_r.dimen_id).name+&quot;1&quot;.to_s</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line787">787</a>            dimen_r.total = t_result[0].send(columnname)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line788">788</a>        else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line789">789</a>           columnname=Part.find(part_r.part_id).name+&quot;0&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line790">790</a>           dimen_r.total = t_result[0].send(columnname)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line791">791</a>        end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line792">792</a>      end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line793">793</a>     render :layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line794">794</a>    end</pre></td>
          </tr>
        
          
          
          <tr class="inferred">
            <td><pre><a name="line795">795</a>    </pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line796">796</a>    def ruiwen</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line797">797</a>     do_report</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line798">798</a>     #获取 被测者 年龄</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line799">799</a>     age= @test_record.age</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line800">800</a>     if age==nil ||age &lt;5</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line801">801</a>         age=5</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line802">802</a>     elsif age &gt;=17.1</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line803">803</a>         age=20</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line804">804</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line805">805</a>     get_ruiwen_marks(age,@total)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line806">806</a>     </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line807">807</a>     render   :template =&gt; &quot;user/reports/custom/ruiwen&quot; , :layout =&gt; false</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line808">808</a>    end</pre></td>
          </tr>
        
          
          
          <tr class="marked">
            <td><pre><a name="line809">809</a>    def get_ruiwen_marks(age,tatol)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line810">810</a>     #puts tatol.to_s+&quot;=======&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line811">811</a>      data = YAML.load_file(RAILS_ROOT + &quot;/db/yaml/ruiwen.yml&quot;)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line812">812</a>      column_name=&quot;age&quot;</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line813">813</a>      @index=6</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line814">814</a>      str=age.to_s</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line815">815</a>      str1=str.split(&quot;.&quot;)</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line816">816</a>        if str1.size &gt;1</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line817">817</a>          column_name=column_name+str1[0]+str1[1]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line818">818</a>        else</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line819">819</a>           column_name=column_name+str</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line820">820</a>        end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line821">821</a>      #puts  data[send(#{column_name})]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line822">822</a>      data_arr=data[:&quot;#{column_name}&quot;]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line823">823</a>     for i in 1...data_arr.size</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line824">824</a>        if tatol &gt;= data_arr[i]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line825">825</a>            @index=i</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line826">826</a>            break</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line827">827</a>        end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line828">828</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line829">829</a>     </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line830">830</a>     def ruiwen_xml</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line831">831</a>         @score=params[:id]</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line832">832</a>     end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line833">833</a>  #   puts @index.to_s+&quot;-=-=-=-=-=-=-=-=-=&quot;+data_arr[@index].to_s</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line834">834</a>     @total_mark=data[:or_marks][@index];</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line835">835</a>   end</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line836">836</a> </pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line837">837</a>   #-----------------------------------------------</pre></td>
          </tr>
        
          
          
          <tr class="uncovered">
            <td><pre><a name="line838">838</a> end</pre></td>
          </tr>
        
      </tbody>
    </table>

    <p>Generated on Wed Mar 17 14:12:44 +0800 2010 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>

  </body>
</html>
